/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package SolvedProblems;

import java.io.File;
import java.util.Scanner;

/**
 *
 * @author Power User
 */
//What's the frequency Kenneth? problem 499
public class Previous {

    public static void main(String args[]) {
        File f = new File("input.txt");
        try {
            Scanner scan = new Scanner(f);
            while (scan.hasNext()) {  //while - 0
                String line = scan.nextLine();
                int start;
                int index = 0;
                //this array holds A to Z followed by a to z
                //frequency
                int[][] freqNextInd = new int[26 * 2][2];
                init_array(freqNextInd, -1);
                index = find_next_char_position(line, 0);
                char firstCh = line.charAt(index);
                start = find_array_postion(firstCh);

                while (index < line.length()) {
                    index = find_next_char_position(line, index);
                    char charCur = line.charAt(index);
                    int arrInd = find_array_postion(charCur);
                    freqNextInd[arrInd][0]++;   //increment frequency
                    index++;
                    char charNex; // = line.charAt(index);

                    do {
                        if (index >= line.length()) {
                            break;
                        }
                        charNex = line.charAt(index);
                        if (freqNextInd[arrInd][1] == -1) {
                            freqNextInd[arrInd][1] = find_array_postion(charNex);
                        }
                        if (charNex == charCur) {
                            freqNextInd[arrInd][0]++;
                        }
                        index++;
                        index = find_next_char_position(line, index);

                    } while (charNex == charCur || !(Character.isLetter(charNex)));//end while

                }//end while
                System.out.println("Ellow");
            }//end of while - 0
        } catch (Exception ex) {
        }//end of try catch
    }//end of main function

    //initializes array arr with value val
    static void init_array(int[][] arr, int val) {
        for (int row = 0; row < arr.length; row++) {
            arr[row][1] = val;
        }
    }//end of init_array

    static int find_next_char_position(String line, int startIndex) {
        int index = startIndex;
        for (; index < line.length(); index++) {      // while 0 - 1
            char ch = line.charAt(index);
            if (Character.isLetter(ch) == false) {
                continue;
            }
            break;
        }//end while - 0->1
        return index;
    }//end of find_next_char

    static int find_array_postion(char ch) {
        int index;
        if (ch >= 'a' && ch <= 'z') {
            index = 26 + ch - 'a';
        } else {
            index = ch - 'A';
        }
        return index;
    }//end of find_array_position
}//end of Main Class

